package de.fh.dortmund.pk1.aufgabe1.gui;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.JPanel;

public class ImageOutput extends JPanel {

  /* Bildcontainer */
  private Image imageContainer;

  /* Bildweite */
  private int   imgWidth;

  /* Bildhoehe */
  private int   imgHight;

  public ImageOutput(int newImgWidth, int newImgHeight) {
    this.imgWidth = newImgWidth;
    this.imgHight = newImgHeight;
  }

  public void setImage(Image newImg) {
    this.imageContainer = newImg;
  }

  public Image getImage() {
    return this.imageContainer;
  }

  public void paintComponent(Graphics toPaint) {
    super.paintComponent(toPaint);
    toPaint.drawImage(imageContainer, 0, 0, this);
  }

  public Dimension getPreferredSize() {
    Dimension d = new Dimension(this.imgWidth, this.imgHight);
    return d;
  }
} 